//#include <avr/io.h>
#include<stdio.h>
#include "SoftwareUart.h"
#include "UartProtocol.h"
#include "../Protocol.h"
#include "../../bitarray/BitArray.h"

int main()
{
	SoftwareUartConfig c;
	c.dataSize = 7;
	c.stopNumber = 0;
	c.polarity = 0;
	c.io = 0;
	c.finished = 0;
	unsigned char bit = 0;
	SoftwareUart u = SoftwareUart();
	BitPointer pointer = BitPointer(&bit, 0);
	BitArray array = BitArray();
	array = BitArray(10);
	array = BitArray();
	SoftwareUart machine = SoftwareUart(c, pointer);
	//Shifter shift = Shifter();
	//printf("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaa\n");
	//printf("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBb\n");
	UartProtocol p = UartProtocol(machine);


/*
	UartStateMachine machine =  UartStateMachine(1,1, NoParity, 8, pointer);
	UartStateMachine machine2 = UartStateMachine(1,1, NoParity, 8, pointer);
	SoftwareUartInterface interface = SoftwareUartInterface(&machine);
	SoftwareUartInterface interface2 = SoftwareUartInterface(&machine2);
	Protocol* protocol = &interface;
	Protocol* protocol2 = &interface2;
*/

/*
	unsigned char sendTest[] = "apples taste great!\n";
	printf("The test string is \"%s\"\n", sendTest);

	for(int i = 0; i < sizeof(sendTest)/sizeof(unsigned char); i++)
	{
		//iterate through each character now for testing.
		protocol->writeByte(sendTest[i]);
	}
	printf("Finished writing the string to the usart protocol object\n");
	for(int i = 0; i < 10*(sizeof(sendTest)/sizeof(unsigned char)); i++)
	{
		
		protocol->run();
		protocol2->run();
	}
	printf("Printing the string sent now.\n");
	while(protocol2->empty() != 1)
		printf("%d\n", protocol2->readByte());
	printf("\n\nFinished now \n\n");
*/
	return 0;
}


